<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
	<link rel="stylesheet" type="text/css" href="template/css.css"
		media="all" />
	<title>QueroTeto</title>
</h:head>
<h:body>
	<p:dialog header="Informe sua cidade" widgetVar="dlg" closable="false"
		modal="true" visible="true"
		rendered="#{!cidadeUsuarioBean.informouCidade}">
		<h:form>
			<p:panelGrid columns="2">
				<h:outputText value="Qual é seu estado? " />
				<p:selectOneMenu value="w" required="true">
					<f:selectItem itemLabel="--Selecione--" itemValue="" />
					<f:selectItem itemLabel="Ceará" itemValue="ceara" />
					<f:selectItem itemLabel="Outro" itemValue="outro" />
				</p:selectOneMenu>

				<h:outputText value="Qual é sua cidade? " />
				<p:selectOneMenu value="#{cidadeUsuarioBean.cidade}" required="true">
					<f:selectItem itemLabel="--Selecione--" itemValue="" />
					<f:selectItem itemLabel="Quixadá" itemValue="quixada" />
					<f:selectItem itemLabel="Iguatu" itemValue="iguatu" />
					<f:selectItem itemLabel="Sobral" itemValue="sobral" />
					<f:selectItem itemLabel="Pacajus" itemValue="pacajus" />
					<f:selectItem itemLabel="Outro" itemValue="outro" />
				</p:selectOneMenu>

				<p:commandButton id="btn" value="Entrar no site" action="#{cidadeUsuarioBean.addCidade}" ajax="false" onclick="dlg.hide()" />
				
			</p:panelGrid>

		</h:form>

	</p:dialog>

	<div id="fb-root"></div>
	<script>
		(function(d, s, id) {
			var js, fjs = d.getElementsByTagName(s)[0];
			if (d.getElementById(id))
				return;
			js = d.createElement(s);
			js.id = id;
			js.src = "//connect.facebook.net/pt_BR/all.js#xfbml=1";
			fjs.parentNode.insertBefore(js, fjs);
		}(document, 'script', 'facebook-jssdk'));
	</script>

	<div id="corpo">
		<ui:include src="/template/topo.xhtml" />
		<ui:include src="/template/menu.xhtml" />
		<div id="slide"></div>
		<div id="conteudo">
			<div id="centro">
				<p:galleria value="#{galeriaBean.images}" var="image"
					panelWidth="650" panelHeight="250" showCaption="true">
					<p:graphicImage value="img/slide/#{image}" title="Aluga-se" />
				</p:galleria>
				<br />
				<h:form>
					<p:carousel id="basicCarousel" value="#{imovelBean.listIndex}"
						var="imovel" itemStyleClass="carItem" numVisible="2">
						<f:facet name="header">  
			            	Imóveis  
			    		</f:facet>
						<h:panelGrid columns="1" width="320px" cellpadding="2px"
							cellspacing="2px">

							<h:outputText value="#{imovel.rua}" />

							<h:outputText value="#{imovel.bairro}" />

							<h:outputText
								value="#{imovel.garagem?'Possui Garagem' : 'Não possui garagem'}" />

							<p:commandButton value="Detalhes"
								action="#{imovelBean.visualizarImovel}">
								<f:param name="id" value="#{imovel.idPk}" />
							</p:commandButton>
						</h:panelGrid>
					</p:carousel>
				</h:form>

			</div>
			<div id="direita" align="center">
				<p:tabView effect="clip" effectDuration="normal">
					<p:tab title="Imóveis">
						<h:form>

							<h:panelGrid columns="2">

								<p:outputLabel value="Cidade " for="cidade" />
								<p:selectOneMenu value="#{imovelBean.imovel.cidade}" id="cidade">
									<f:selectItem itemLabel="Todas as Cidades" itemValue="" />
									<f:selectItems value="#{imovelBean.dao.listCidades}" />
								</p:selectOneMenu>
								<p:outputLabel value="Quartos " for="quartos" />
								<p:selectOneMenu value="#{imovelBean.imovel.qtdQuartos}"
									id="quartos">
									<f:selectItem itemLabel="Todos" itemValue="0" />
									<f:selectItem itemLabel="1" itemValue="1" />
									<f:selectItem itemLabel="2" itemValue="2" />
									<f:selectItem itemLabel="3" itemValue="3" />
									<f:selectItem itemLabel="4" itemValue="4" />
									<f:selectItem itemLabel="5" itemValue="5" />
									<f:selectItem itemLabel="6" itemValue="6" />
									<f:selectItem itemLabel="7" itemValue="7" />
									<f:selectItem itemLabel="8" itemValue="8" />
									<f:selectItem itemLabel="9" itemValue="9" />
								</p:selectOneMenu>
								<p:outputLabel value="Banheiros " for="banheiros" />
								<p:selectOneMenu value="#{imovelBean.imovel.qtdBanheiros}"
									id="banheiros">
									<f:selectItem itemLabel="Todos" itemValue="0" />
									<f:selectItem itemLabel="1" itemValue="1" />
									<f:selectItem itemLabel="2" itemValue="2" />
									<f:selectItem itemLabel="3" itemValue="3" />
									<f:selectItem itemLabel="4" itemValue="4" />
									<f:selectItem itemLabel="5" itemValue="5" />
									<f:selectItem itemLabel="6" itemValue="6" />
									<f:selectItem itemLabel="7" itemValue="7" />
									<f:selectItem itemLabel="8" itemValue="8" />
									<f:selectItem itemLabel="9" itemValue="9" />
								</p:selectOneMenu>
								<p:outputLabel value="Garagem " for="garagem" />
								<p:selectBooleanCheckbox id="garagem"
									value="#{imovelBean.imovel.garagem}" />
							</h:panelGrid>
							<br />
							<p:tooltip for="pesquisar"
								value="Campos de preenchimento não obrigatório para efetuar a pesquisa"
								showEffect="fade" hideEffect="fade" />
							<p:commandButton value="Pesquisar"
								action="#{imovelBean.pesquisaImovel}" id="pesquisar" />
						</h:form>
					</p:tab>
					<p:tab title="Pessoas">

						<h:form>

							<p:panelGrid columns="2">
								<p:outputLabel value="Sexo" for="sexo" />
								<p:selectOneMenu value="#{usuarioBean.usuario.sexo}" id="sexo">
									<f:selectItem itemLabel="Todos" itemValue="" />
									<f:selectItem itemLabel="M" itemValue="M" />
									<f:selectItem itemLabel="F" itemValue="F" />
								</p:selectOneMenu>

								<p:outputLabel value="Bebe" for="bebe" />
								<p:selectOneMenu value="#{usuarioBean.usuario.perfil.bebe}"
									id="bebe">
									<f:selectItem itemLabel="Sim" itemValue="true" />
									<f:selectItem itemLabel="Não" itemValue="false" />
								</p:selectOneMenu>

								<p:outputLabel value="Fuma" for="fuma" />
								<p:selectOneMenu value="#{usuarioBean.usuario.perfil.fuma}"
									id="fuma">
									<f:selectItem itemLabel="Sim" itemValue="true" />
									<f:selectItem itemLabel="Não" itemValue="false" />
								</p:selectOneMenu>

								<p:outputLabel value="Cidade" for="cidade" />
								<p:selectOneMenu value="#{usuarioBean.usuario.cidade}"
									id="cidade">
									<f:selectItem itemLabel="Todos" itemValue="" />
									<f:selectItems value="#{usuarioBean.cidades}" />
								</p:selectOneMenu>
								<p:commandButton value="Pesquisar"
									action="#{usuarioBean.pesquisa}" />

							</p:panelGrid>
						</h:form>

					</p:tab>

				</p:tabView>

				<p:panel header="Facebook">
					<div class="fb-like"
						data-href="https://www.facebook.com/queroteto?fref=ts"
						data-width="270" data-show-faces="true" data-font="lucida grande"></div>
				</p:panel>
				<ui:include src="/template/publicidade.xhtml" />


			</div>
		</div>
		<div id="both" align="center"></div>
		<ui:include src="/template/rodape.xhtml" />
	</div>
</h:body>
</html>